
/**
 * AppleIIGo
 * V2D Disk Image class
 * (C) 2008 by Marc S. Ressl (mressl@umich.edu)
 * Released under the GPL
 */

#include "NibbleDiskImage.h"

#ifndef V2DDISKIMAGE_H
#define V2DDISKIMAGE_H

#define V2D_CONTAINER_BYTENUM		8
#define V2D_HEADER_BYTENUM			10
#define V2D_TRACKHEADER_BYTENUM		4

struct V2dHeaderType {
	UINT32 byteNum;
	char id[4];
	UINT16 trackNum;
};

struct V2dTrackType {
	UINT16 trackIndex;
	UINT16 trackByteNum;
};

class V2DDiskImage : public NibbleDiskImage {
public:
	static bool isDiskImageValid(UINT32 floppyDiskType, char * diskImagePath);
	
	V2DDiskImage(char * diskImagePath);
	~V2DDiskImage();
	
private:
	static bool readV2dHeader(FILE * diskImagePath,
							  UINT32 * diskImageTrackNum);
	bool readDiskImageTrack(UINT32 diskImageTrackIndex, bool isSetTrackBitNum);
	bool readDiskImage(bool isSetTrackBitNum);
};

#endif
